home *** CD-ROM | disk | FTP | other *** search
- ; This sample shows
- ; the use of emu8086.inc
- ; library of predefined
- ; macros and procedures.
-
- #make_COM#
-
- INCLUDE 'emu8086.inc'
-
- ORG 100h
-
- ; print out some chars,
- ; using macro:
- PUTC 'H'
- PUTC 'i'
- PUTC ' '
- PUTC 'T'
- PUTC 'h'
- PUTC 'e'
- PUTC 'r'
- PUTC 'e'
- PUTC '!'
-
- ; new line:
- PUTC 13
- PUTC 10
-
- ; print string using macro
- ; with carriage return in the end:
- PRINTN 'I love Assembly!'
-
- ; print string using procedure:
- LEA SI, msg
- CALL print_string
-
- ; input a number into CX
- ; using procedure:
- CALL scan_num
-
- ; new line:
- PUTC 13
- PUTC 10
-
- PRINT "You've entered: "
- MOV AX, CX
- ; print out the number in AX
- ; using procedure:
- CALL print_num
-
-
- RET
-
- msg DB 'Enter a number: ', 0
-
- ;=================================
- ; here we define the functions
- ; from emu8086.inc
-
- ; SCAN_NUM reads a
- ; number from the user and stores
- ; it in CX register:
- DEFINE_SCAN_NUM
-
- ; PRINT_STRING prints a null
- ; terminated string, the address
- ; of the string is in DS:SI
- DEFINE_PRINT_STRING
-
- ; PRINT_NUM prints a signed
- ; number in AX.
- ; (PRINT_NUM requires the declaration
- ; of PRINT_NUM_UNS).
- ; PRINT_NUM_UNS prints an unsigned
- ; number in AX:
-
- DEFINE_PRINT_NUM
- DEFINE_PRINT_NUM_UNS
-
- ;=================================
-
- END
-